package Server_Netty;

public class Test_TCP_Server {
    /**
     * 编写的一个测试样例，用来创建TCP通道
     * */

    public static final int Channel_RoleID_1=6501;
    public static final int Channel_RoleID_2=6502;
    public static final int Channel_RoleID_3=6513;
    public static final int Channel_RoleID_4=6514;

    public static final String LOCAL_ADDRESS = "10.133.151.77";    //每次监听的本地IP地址

    public static void main(String[] args) throws Exception {
        Main_Send_Receive_Manager main_send_receive_manager = new Main_Send_Receive_Manager();

        //创建4条TCP通道
        int[] Connect_RoleId = {Channel_RoleID_1,Channel_RoleID_2,Channel_RoleID_3,Channel_RoleID_4};
        int[] Connect_Port = {5001,5002,5003,5004};
        String[] Local_Address = {LOCAL_ADDRESS,LOCAL_ADDRESS,LOCAL_ADDRESS,LOCAL_ADDRESS};
        String[] Connect_Way = {"TCP", "TCP", "TCP", "UDP"};

        main_send_receive_manager.ServerStart(Connect_Way,Connect_RoleId,Local_Address,Connect_Port);


        //创建4条通道对应的数据接收任务 —— 把接收到的数据存入本地文件（具体看GetDataFromTCPServer类里面的处理）
        GetDataFromServer test1 = new GetDataFromServer(Channel_RoleID_1);
        test1.start();

        GetDataFromServer test2 = new GetDataFromServer(Channel_RoleID_1);
        test2.start();

        GetDataFromServer test3 = new GetDataFromServer(Channel_RoleID_1);
        test3.start();

        GetDataFromServer test4 = new GetDataFromServer(Channel_RoleID_1);
        test4.start();

        while(true) {
            Thread.sleep(1);
        }
    }
}